package util.bio.annotation;
import java.io.*;
import util.gen.*;

import util.bio.parsers.*;

public class ExportExons {

	private File ucscTableFile;
	private boolean subtractOne = false;	
	private UCSCGeneModelTableReader genes;

	public ExportExons (File ucscTableFile){
		this.ucscTableFile = ucscTableFile;
		int num =0;
		if (subtractOne) num = 1;
		genes = new UCSCGeneModelTableReader(ucscTableFile, num);
		UCSCGeneLine[] lines = genes.getGeneLines();
		for (int i=0; i< lines.length; i++){
		ExonIntron[] exons = lines[i].getExons();
		String chr = lines[i].getChrom();
			for (int j=0; j< exons.length; j++){
				System.out.println(chr+"\t"+exons[j].getStart()+"\t"+exons[j].getEnd());
			}
		}

	}


	public static void main(String[] args) {
		if (args.length ==0){
			Misc.printExit("\nEnter the full path file name for a UCSC formatted gene table.  All exons will be printed to screen.\n");
		}
		new ExportExons(new File (args[0]));
	}		

	

}

